home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AppsToGo / DTS.Lib / DTS.Lib.headers / Window2.h < prev   
Encoding:
C/C++ Source or Header  |  1994-09-22  |  50.2 KB  |  1,340 lines  |  [TEXT/KAHL]

  1. #ifndef __WINDOW2__
  2. #define __WINDOW2__
  3.  
  4. #ifndef __TYPES__
  5. #include <Types.h>
  6. #endif
  7.  
  8.  
  9.  
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13.  
  14.  
  15.  
  16. OSErr            DoNewWindow(FileRecHndl frHndl, WindowPtr *retWindow,
  17.                             WindowPtr relatedWindow, WindowPtr behind);
  18.     /*
  19.     **    ¶ Create window for AppsToGo document.
  20.     **
  21.     **    INPUT:    frHndl            This file reference is used to create a window.  At this
  22.     **                            point there is (or should be) window creation information
  23.     **                            in the file reference.  If you are using the AppsToGo
  24.     **                            application editor to create your documents, then the
  25.     **                            information is in the file reference at this point.
  26.     **            relatedWindow    This window is what is used to determine which monitor
  27.     **                            the window should be created on.  If there is a related
  28.     **                            window passed in, DoNewWindow determines which monitor
  29.     **                            holds most of the window.  That monitor is then the
  30.     **                            target monitor for the new window.
  31.     **            behind            This window is the window that the new window is created
  32.     **                            behind.  Pass in -1 if the window is to be created as
  33.     **                            the frontmost window.  Pass in 0 if it is to be created
  34.     **                            as the backmost window.
  35.     **    OUTPUT:    retWindow        Return the created window here.  If you don’t care to
  36.     **                            know, then pass in nil.
  37.     **    RESULT:    OSErr            If an error is returned, then no window was created.
  38.     **
  39.     **    This function is called by the application or framework at appropriate times to
  40.     **    give a document a window.  To create a document window, first a document is created
  41.     **    by the application via NewDocument or OpenDocument.  If this succeeds then the
  42.     **    application needs to create a window for the document.  To do this, the application
  43.     **    calls DoNewWindow.  DoNewWindow calls the content initialization procedure, which
  44.     **    by default is InitContent.  If you want a different content initialization
  45.     **    procedure, replace the default procedure pointer initContentProc with your own.
  46.     **    Normally however, you will just place your own content initialization procedure in
  47.     **    the function InitContent.  It is possible though that your application has more
  48.     **    than one document type and window type.  If this is the case, then you may very
  49.     **    well want an alternate content initialization procedure.  If you do, you will want
  50.     **    to replace the default procedure pointer after the NewDocument or OpenDocument
  51.     **    call and before the call to DoNewWindow.  (You may place the code for replacing the
  52.     **    content initialization procedure and imaging procedure in the function InitDocument.
  53.     **    The defaults are already established at that point.  You would just replace them
  54.     **    with the alternates.
  55.     **
  56.     **    __________
  57.     **
  58.     **    Also see:    NewDocument, OpenDocument. */
  59.  
  60.  
  61. void            NewWindowTitle(WindowPtr window, StringPtr altTitle);
  62.     /*
  63.     **    ¶ Change the window/document title.
  64.     **
  65.     **    INPUT:    window
  66.     **            altTitle
  67.     **
  68.     **    Call this function if you want to change the title of the window.
  69.     **    If you pass in nil, the window title will be gotten from the FSSpec of the
  70.     **    document.  If you pass in an alternate title in altTitle, that will be used
  71.     **    instead of the document name. */
  72.  
  73.  
  74.  
  75. Boolean            DisposeAllWindows(void);
  76.     /*
  77.     **    ¶ Dispose the windows, giving user the chance to abort.
  78.     **
  79.     **    This function iterates through all of the windows and calls DisposeOneWindow
  80.     **    on each one.  If DisposeOneWindow returns that the user canceled the closing
  81.     **    of a window that needed saving, then DisposeAllWindows also aborts.  This
  82.     **    is used when an application is quitting. */
  83.  
  84.  
  85.  
  86. Boolean            DisposeOneWindow(WindowPtr window, short saveMode);
  87.     /*
  88.     **    ¶ Dispose one window, giving the user the chance to abort.
  89.     **
  90.     **    INPUT:    window
  91.     **            saveMode
  92.     **
  93.     **    This function does exactly as you would expect.  The saveMode indicates
  94.     **    whether the window is being closed due to a close request, or due to the
  95.     **    application being quit.  If true is returned, then disposing of the window
  96.     **    was successful.  If false is returned, the user may have canceled the close
  97.     **    due to the document needing to be saved, a dialog as such popping up, and
  98.     **    the user clicking cancel.
  99.     **
  100.     **    If the user says it is okay to dispose the window, DisposeOneWindow calls
  101.     **    the window’s FreeWindow and FreeDocument procedures to give the application
  102.     **    a chance to release application-specific memory associated with the window
  103.     **    and document.
  104.     **
  105.     **    __________
  106.     **
  107.     **    Also see:    DisposeAllWindows. */
  108.  
  109.  
  110. WindowPtr        SetFilePort(FileRecHndl frHndl);
  111.     /*
  112.     **    ¶ Given file, set the port to the document’s port.
  113.     **
  114.     **    INPUT:    frHndl
  115.     **
  116.     **    This function sets the current port for the designated file.  It also returns
  117.     **    the old port so that the port can be restored, if so desired.  Note that you
  118.     **    can always get the window for a document by simply dereferencing the doc handle
  119.     **    as follows:  window = (*frHndl)->fileState.window;
  120.     **    Keep in mind that a document doesn’t have to have a window.  If you created the
  121.     **    document yourself via NewDocument or OpenDocument, the document doesn’t have a
  122.     **    window assigned to it yet, and therefore the above dereference will return nil. */
  123.  
  124.  
  125.  
  126. void            DoResizeWindow(WindowPtr window, short oldh, short oldv);
  127.     /*
  128.     **    ¶ Called after a window is resized via grow or zoom.
  129.     **
  130.     **    INPUT:    window
  131.     **            oldh
  132.     **            oldv
  133.     **
  134.     **    This function is called when a window is resized.  This function may need
  135.     **    to know the old size of the window.  The new size is determined by the
  136.     **    dimensions of the window that was resized.  It moves and resizes the
  137.     **    document scrollbars and growIcon (if any) to reflect the new size of
  138.     **    the window.  It then calls the procedure stored in the procPtr field
  139.     **    resizeContentProc, in case there is additional sizing necessary for the window.
  140.     **    The default resizeContentProc is ResizeContent.  If you wish an alternate
  141.     **    resizeContentProc, then you can replace the default in the function
  142.     **    InitDocument, as the default is already established at this point. */
  143.  
  144.  
  145.  
  146. void            GetWindowChange(WindowPtr window, short oldh, short oldv, short *dx, short *dy);
  147.     /*
  148.     **    ¶ Given the old size, this returns the difference between the old size and the new size.
  149.     **
  150.     **    INPUT:    window
  151.     **            oldh
  152.     **            oldv
  153.     **    OUTPUT:    dx
  154.     **            dy
  155.     **
  156.     **    This function returns the difference between the old window size and the new window
  157.     **    size.  Pass in the old window size, and this function looks up the current size,
  158.     **    gets the difference, and returns it. */
  159.  
  160.  
  161.  
  162. void            DoUpdateSeparate(WindowPtr window, RgnHandle *contRgn, RgnHandle *frameRgn);
  163.     /*
  164.     **    ¶ Separates the updateRgn into a frameRgn and a contentRgn.
  165.     **
  166.     **    INPUT:    window
  167.     **    OUTPUT:    contRgn
  168.     **            frameRgn
  169.     **
  170.     **    This function separates the update region into two portions.  One portion is
  171.     **    the frame area, which consists of document scrollbars and growIcon (if any), plus
  172.     **    an optional application-defined frame area.  The other portion is the rest of the
  173.     **    window content that needs updating.  This separation is so that the document
  174.     **    scrollbars can be updated first, and then this area can be clipped out of the rest
  175.     **    of the updating so that the window content doesn’t draw over the document
  176.     **    scrollbars and growIcon.  The clipping is managed with just the visRgn.  This frees
  177.     **    up the clipRgn for application specific clipping.  Note that if either region
  178.     **    is computed to be empty, DoUpdateSeparate will return a nil for that handle.
  179.     **
  180.     **    __________
  181.     **
  182.     **    Also see:    BeginContent, EndContent, BeginFrame, EndFrame, DoCalcScrollRgn, DoCalcFrameRgn. */
  183.  
  184.  
  185.  
  186. void            BeginContent(WindowPtr window);
  187.     /*
  188.     **    ¶ Used instead of BeginUpdate to draw to just the content area.
  189.     **
  190.     **    INPUT:    window
  191.     **
  192.     **    This function clips out the document scrollbars and growIcon from the updatable
  193.     **    area.  It also sets the origin of the port to the current document scrollbar
  194.     **    values.  BeginContent must be balanced by a call to EndContent.  BeginContent calls
  195.     **    BeginUpdate, and BeginUpdate calls can’t be nested.  Due to this, BeginContent has
  196.     **    a usage counter, which prevents nested calls to BeginUpdate.  BeginContent clips
  197.     **    out the document scrollbar and growIcon area without involving the clipRgn so that
  198.     **    the application is free to use the clipRgn as it sees fit.  The only caveat is that
  199.     **    you can not modify the updateRgn between the BeginContent and EndContent calls, as
  200.     **    anything contributed to the updateRgn between these calls will be lost.  If you
  201.     **    need to do this, accumulate the areas in a separate region, call EndContent, and
  202.     **    then call InvalRgn.
  203.     **
  204.     **    __________
  205.     **
  206.     **    Also see:    BeginFrame, EndFrame, DoCalcScrollRgn, DoCalcFrameRgn, DoUpdateSeparate. */
  207.  
  208.  
  209. void            EndContent(WindowPtr window);
  210.     /*
  211.     **    ¶ Used instead of EndUpdate to balance BeginContent calls.
  212.     **
  213.     **    INPUT:    window
  214.     **
  215.     **    Calls to BeginContent must be balanced.  They also don’t nest.  EndContent undoes
  216.     **    the clipping of the frame area that BeginContent invoked.
  217.     **
  218.     **    __________
  219.     **
  220.     **    Also see:    BeginFrame, EndFrame, DoCalcScrollRgn, DoCalcFrameRgn, DoUpdateSeparate. */
  221.  
  222.  
  223.  
  224. void            BeginFrame(WindowPtr window);
  225.     /*
  226.     **    ¶ Used instead of BeginUpdate to draw to just the frame area.
  227.     **
  228.     **    INPUT:    window
  229.     **
  230.     **    This function does the same thing as BeginContent, except that it clips out everything
  231.     **    except the frame area.  The frame area consists of the sidebars and any additional
  232.     **    application-defined frame area.  The application-defined frame area is defined in the
  233.     **    AppWannabe function CalcFrameArea.  Also, the origin is set to -16384,0, which is the
  234.     **    coordinate space for sidebar controls created with the AppsToGo application editor.
  235.     **    Calls to BeginFrame must be balanced with calls to EndFrame.
  236.     **
  237.     **    __________
  238.     **
  239.     **    Also see:    BeginContent, EndContent, DoCalcScrollRgn, DoCalcFrameRgn, DoUpdateSeparate. */
  240.  
  241.  
  242.  
  243. void            EndFrame(WindowPtr window);
  244.     /*
  245.     **    ¶ Used instead of EndUpdate to balance BeginFrame calls.
  246.     **
  247.     **    INPUT:    window
  248.     **
  249.     **    Calls to BeginFrame must be balanced.  They also don’t nest.  EndFrame undoes the
  250.     **    clipping of the frame area that BeginFrame invoked.
  251.     **
  252.     **    __________
  253.     **
  254.     **    Also see:    BeginContent, EndContent, DoCalcScrollRgn, DoCalcFrameRgn, DoUpdateSeparate. */
  255.  
  256.  
  257.  
  258. void            AdjustScrollBars(WindowPtr window);
  259.     /*
  260.     **    ¶ Modify scrollbar values to reflect other window changes.
  261.     **
  262.     **    INPUT:    window
  263.     **
  264.     **    You call this function whenever you need the scrollbars to reflect the window
  265.     **    state and position.  If you change the sidebar sizes or indent sizes by hand,
  266.     **    you will need to call this.  Generally an application will not have to call this
  267.     **    directly, as there are functions for scrolling, setting sidebar sizes, indent
  268.     **    sizes, etc. */
  269.  
  270.  
  271.  
  272. void            GetContentOrigin(WindowPtr window, Point *contOrg);
  273.     /*
  274.     **    ¶ Return the origin of the content of the window.
  275.     **
  276.     **    INPUT:    window
  277.     **    OUTPUT:    contOrg
  278.     **
  279.     **    This function returns the origin of the content of the window.  The value
  280.     **    is gotten from the current value of the document scrollbars.  If a scrollbar
  281.     **    is missing, the control value for that scrollbar is assumed to be 0.  Note that
  282.     **    if you have sidebars in your document, the origin value has the sidebar value
  283.     **    subtracted.  For example:  You have a top sidebar of 32 pixels, and the vertical
  284.     **    scrollbar has a control value of 0.  This will return you a vertical origin
  285.     **    of -32.
  286.     **
  287.     **    __________
  288.     **
  289.     **    Also see:    SetContentOrigin. */
  290.  
  291.  
  292.  
  293. void            SetContentOrigin(WindowPtr window, long newh, long newv);
  294.     /*
  295.     **    ¶ Change the origin of the content of the window.
  296.     **
  297.     **    INPUT:    window
  298.     **            newh
  299.     **            newv
  300.     **
  301.     **    This function allows you to change the value of the document scrollbars, and by doing
  302.     **    this, the document is scrolled to reflect the change, and an update event is generated
  303.     **    for the document scroll.  Note that if you are using sidebars, you will have to subtract
  304.     **    the value of the sidebar to get the expected results.  Also note that this function
  305.     **    accepts long values.  You may have a proc for handling longs for the document scrollbars.
  306.     **    The proc is stored in the refCon of the document scrollbars.  If the refCon
  307.     **    value of the document scrollbars is 0, then it is assumed that values from 0
  308.     **    to 32767 are adequate for document scrolling.
  309.     **
  310.     **    __________
  311.     **
  312.     **    Also see:    GetContentOrigin. */
  313.  
  314.  
  315.  
  316. void            GetContentRect(WindowPtr window, Rect *contRct);
  317.     /*
  318.     **    ¶ Get bounding rect of the content area of the window.
  319.     **
  320.     **    INPUT:    window
  321.     **    OUTPUT:    contRct
  322.     **
  323.     **    This function returns a rectangle that represents the content area of the
  324.     **    window less the scrollbar and sidebar areas. */
  325.  
  326.  
  327.  
  328. void            SetDocSize(FileRecHndl frHndl, long hSize, long vSize);
  329.     /*
  330.     **    ¶ Set new document size and make approprate adjustments to the window.
  331.     **
  332.     **    INPUT:    frHndl
  333.     **            hSize
  334.     **            vSize
  335.     **
  336.     **    This function sets the document size to the new designated size.  It also
  337.     **    makes appropriate adjustments to the scrollbars to reflect the new size.
  338.     **    SetDocSize will not cause the window to scroll, even if you set the doc
  339.     **    size much smaller.  If the document shrinks such that the bottom of the
  340.     **    document is above the top of the window, it is not automatically scrolled
  341.     **    into place.  (This is the same behavior as system 7 finder.)  When the
  342.     **    user scrolls the document into view, the scrollbar range will be reduced
  343.     **    so that the user can’t scroll the document back out of view. */
  344.  
  345.  
  346.  
  347. void            SetSidebarSize(FileRecHndl frHndl, short newLeft, short newTop);
  348.     /*
  349.     **    ¶ Change the size of one or both sidebars.  Window is adjusted accordingly.
  350.     **
  351.     **    INPUT:    frHndl
  352.     **            newLeft
  353.     **            newTop
  354.     **
  355.     **    This function is used to set the size of the sidebars.  This is particularly
  356.     **    useful for being able to show and hide a tool palette, or if you are using
  357.     **    OCE and want to show a mailer at the top of your window.  The sidebar value
  358.     **    should initially be set in File.c, along with other document initialization.
  359.     **    If you wish to change only one of the two sidebar sizes, send in a value of
  360.     **    kwNoChange for the one that is not to change.
  361.     **
  362.     **    __________
  363.     **
  364.     **    Also see:    SetScrollIndentSize. */
  365.  
  366.  
  367.  
  368. void            SetScrollIndentSize(FileRecHndl frHndl, short newh, short newv);
  369.     /*
  370.     **    ¶ Change the size of the scroll indent area.  Window is adjusted accordingly.
  371.     **
  372.     **    INPUT:    frHndl
  373.     **            newh
  374.     **            newv
  375.     **
  376.     **    This function is used to set the size of the scrollbar indention.  The scrollbar
  377.     **    indentnion allows you to put status information or document display related
  378.     **    tool icons in line with the scrollbar.  They are considered part of the frame,
  379.     **    as document scrollbars, the grow icon, and sidebars are.  The scrollbar indent
  380.     **    value should initially be set in File.c, in the same fashion as sidebar values
  381.     **    are set.  If you wish to change only one of the two scrollbar indent, send in a
  382.     **    value of kwNoChange for the one that is not to change.
  383.     **
  384.     **    __________
  385.     **
  386.     **    Also see:    SetSidebarSize. */
  387.  
  388.  
  389.  
  390. FileRecHndl        GetNextDocument(WindowPtr window, OSType sftype);
  391.     /*
  392.     **    ¶ Iterator to walk window list and return the next document of correct type.
  393.     **
  394.     **    INPUT:    window
  395.     **            sftype
  396.     **    RESULT:    frHndl
  397.     **
  398.     **    This function returns the file reference for the next application window
  399.     **    of the designated kind.  If the window paramater is passed in as nil, it
  400.     **    finds the top-most window whose document type matches the requested OSType.
  401.     **    If the window parameter is passed in as non-nil, it returns the next window.
  402.     **    If there is no next window found, it returns nil.  The sftype parameter
  403.     **    restricts the finding of a window to a particular type.  If 0 is passed in
  404.     **    for sftype, then any application window will match.
  405.     **
  406.     **    __________
  407.     **
  408.     **    Also see:    GetNextWindow, GetPreviousWindow. */
  409.  
  410.  
  411.  
  412. WindowPtr        GetNextWindow(WindowPtr window, OSType sftype);
  413.     /*
  414.     **    ¶ Iterator to walk window list and return the next document window of correct type.
  415.     **
  416.     **    INPUT:    window
  417.     **            sftype
  418.     **
  419.     **    This function behaves the same as GetNextDocument, but returns a window pointer
  420.     **    instead of a file reference.
  421.     **
  422.     **    __________
  423.     **
  424.     **    Also see:    GetNextDocument, GetPreviousWindow. */
  425.  
  426.  
  427.  
  428. WindowPtr        GetPreviousWindow(WindowPtr window);
  429.     /*
  430.     **    ¶ Return the window in front of indicated window.
  431.     **
  432.     **    INPUT:    window
  433.     **
  434.     **    Returns the window in front of the window passed in.  If there is no window
  435.     **    in front, it returns -1, not nil.  -1 is typically used to indicate the front
  436.     **    of the window list, whereas nil is used to indicate the back.  This is done to
  437.     **    stay consistent with the expectations of the toolbox.
  438.     **
  439.     **    __________
  440.     **
  441.     **    Also see:    GetNextDocument, GetNextWindow, GetPreviousWindow. */
  442.  
  443.  
  444.  
  445. void            DoZoomWindow(WindowPtr window, EventRecord *event, short zoomDir);
  446.     /*
  447.     **    ¶ AppsToGo smart zoom.
  448.     **
  449.     **    INPUT:    window
  450.     **            event
  451.     **            zoomDir
  452.     **
  453.     **    This function handles zooming of the document window.  It zooms it to the
  454.     **    current monitor, up to the size of the document data. */
  455.  
  456.  
  457.  
  458. RgnHandle        DoCalcFrameRgn(WindowPtr window);
  459.     /*
  460.     **    ¶ Calculate region that encompasses entire window frame area.
  461.     **
  462.     **    INPUT:    window
  463.     **
  464.     **    This function calculates the region that encompasses the frame area of the
  465.     **    document.  The frame area consists of the document scrollbars, growIcon, sidebars,
  466.     **    and an optional application-defined frame area.  The region is generated in global
  467.     **    coordinates.  Since the frame region may encompass more than the
  468.     **    DTS.framework-supported scrollbars and growIcon, a procedure is first called to see
  469.     **    if there is anything additional in the frame region.  The field calcFrameRgnProc
  470.     **    holds the procedure pointer that contributes any extra to the frame region.  This
  471.     **    function is passed an empty region.  If there is no additional contribution to the
  472.     **    frame region, then the region should be left empty.  Once this procedure is
  473.     **    returned from, the remaining frame portion is added to this region.  The remaining
  474.     **    portion would consist of DTS.framework document scrollbars and a growIcon, if there
  475.     **    are any for this window.  The field calcFrameRgnProc is initialized to the
  476.     **    default value CalcFrameRgn.  If you wish an alternate drawFrameProc, then you
  477.     **    can replace the default in the function InitDocument, as the default is
  478.     **    already established at this point.
  479.     **
  480.     **    __________
  481.     **
  482.     **    Also see:    DoCalcContentRgn, DoCalcScrollRgn. */
  483.  
  484.  
  485.  
  486. RgnHandle        DoCalcScrollRgn(WindowPtr window);
  487.     /*
  488.     **    ¶ Calculate the region that encompasses the document scrollbars and growIcon.
  489.     **
  490.     **    INPUT:    window
  491.     **
  492.     **    This function calculates the region that encompasses the document scrollbars
  493.     **    and growIcon (if any).  The region is generated in global coordinates.
  494.     **
  495.     **    __________
  496.     **
  497.     **    Also see:    DoCalcFrameRgn, DoCalcContentRgn. */
  498.  
  499.  
  500.  
  501. void            DoContentClick(WindowPtr window, EventRecord *event, Boolean firstClick);
  502.     /*
  503.     **    ¶ Process a content click.  May call application to help.
  504.     **
  505.     **    INPUT:    window
  506.     **            event
  507.     **            firstClick
  508.     **
  509.     **    This function is called whenever the content portion of a window is clicked in.
  510.     **    It simply calls the procedure pointer stored in the field contentClickProc.
  511.     **    The field contentClickProc is initialized to ContentClick.  If you wish
  512.     **    an alternate contentClickProc, then you can replace the default in the function
  513.     **    InitDocument, as the default is already established at this point.  The
  514.     **    boolean firstClick is true if you chose this window to handle first clicks, and
  515.     **    if the click is actually a first click in the window.  A first click means that
  516.     **    the window content was clicked on, but the window was not the front window.  The
  517.     **    window has already been brought to the front, but you may wish the click to also
  518.     **    be handled as a content click.
  519.     **
  520.     **    Note that if you call DoContentClick directly, you need to handle the other
  521.     **    aspects of mouseDown events.  Generally you will simply want to call DoMouseDown
  522.     **    from your application.  If the mouseDown end up being in the content of a window,
  523.     **    DoMouseDown will call DoContentClick.
  524.     **
  525.     **    __________
  526.     **
  527.     **    Also see:    DoKeyDown, DoUpdate. */
  528.  
  529.  
  530.  
  531. void            DoDragWindow(WindowPtr window, EventRecord *event, Rect bounds);
  532.     /*
  533.     **    ¶ AppsToGo DragWindow code.  Use this instead of DragWindow.
  534.     **
  535.     **    INPUT:    window
  536.     **            event
  537.     **            bounds
  538.     **
  539.     **    This function is used to drag a window.  We can’t use the toolbox function
  540.     **    DragWindow, as the DTS.framework supports palettes.  Since we are supporting
  541.     **    palettes, we have to be able to drag a window that isn’t the front, and bring
  542.     **    it to the front of windows of its kind.  There is no way to coerce DragWindow
  543.     **    to do this. */
  544.  
  545.  
  546.  
  547. void            DoDrawFrame(WindowPtr window, Boolean activate);
  548.     /*
  549.     **    ¶ Draw the entire frame of a window.  Application may also be called for part.
  550.     **
  551.     **    INPUT:    window
  552.     **            activate
  553.     **
  554.     **    This function may be called when an update event occurs for the window.
  555.     **    If the update region intersects the frame region (calculated by DoCalcFrameRgn),
  556.     **    then a frame update occurs and this function is called.  It redraws the
  557.     **    document scrollbars and growIcon (if any) and then calls the procedure stored
  558.     **    in the field drawFrameProc, which has a default value of DrawFrame.  If you wish
  559.     **    an alternate drawFrameProc, then you can replace the default in the function
  560.     **    InitDocument, as the default is already established at this point. */
  561.  
  562.  
  563.  
  564. OSErr            DoFreeDocument(FileRecHndl frHndl);
  565.     /*
  566.     **    ¶ Opportunity to release a document’s additional memory.
  567.     **
  568.     **    INPUT:    frHndl
  569.     **    RESULT:    OSErr
  570.     **
  571.     **    This is called to generically call the document’s freeing procedure.  This document
  572.     **    is being disposed of, and any custom memory usage needs to be deallocated.  The
  573.     **    frHndl itself will be disposed of, but any handle references that it contains
  574.     **    need to be freed within the document’s freeing procedure.  The default freeing
  575.     **    procedure is called FreeDocument.
  576.     **
  577.     **    Note that DoFreeDocument is called by DisposeOneWindow.  This means that the
  578.     **    application will get a chance to dispose of any related memory due to a call to
  579.     **    DisposeOneWindow. */
  580.  
  581.  
  582.  
  583. OSErr            DoFreeWindow(FileRecHndl frHndl, WindowPtr window);
  584.     /*
  585.     **    ¶ Opportunity to release a window’s additional memory.
  586.     **
  587.     **    INPUT:    frHndl
  588.     **            window
  589.     **    RESULT:    OSErr
  590.     **
  591.     **    This is called to generically call the document’s window freeing procedure.
  592.     **    The window is going to be disposed of, and there may be related tasks to disposing
  593.     **    of the window.  A document may have related windows or views.  This is where you
  594.     **    would dispose of the related windows.  The default window freeing procedure is
  595.     **    called FreeWindow.
  596.     **
  597.     **    Note that DoFreeWindow is called by DisposeOneWindow.  This means that the
  598.     **    application will get a chance to dispose of any related memory due to a call to
  599.     **    DisposeOneWindow. */
  600.  
  601.  
  602.  
  603. OSErr            DoImageDocument(FileRecHndl frHndl);
  604.     /*
  605.     **    ¶ Application window’s imaging procedure (to either window or printer).
  606.     **
  607.     **    INPUT:    frHndl
  608.     **    RESULT:    OSErr
  609.     **
  610.     **    This function is called whenever the content portion of a window needs to be
  611.     **    updated or printed.  It simply calls the procedure pointer stored in the field
  612.     **    imageProc.  The field imageProc is initialized to ImageDocument.  If you wish
  613.     **    an alternate imageProc, then you can replace the default in the function
  614.     **    InitDocument, as the default is already established at this point.
  615.     **    Note that when the document’s imageProc is called, only the content can be
  616.     **    drawn to.  BeginContent is called prior to calling the imageProc, and
  617.     **    EndContent is called upon return. */
  618.  
  619.  
  620.  
  621. OSErr            DoInitContent(FileRecHndl frHndl, WindowPtr window);
  622.     /*
  623.     **    ¶ Application’s opportunity to initialize window content.
  624.     **
  625.     **    INPUT:    frHndl
  626.     **            window
  627.     **    RESULT:    OSErr
  628.     **
  629.     **    The window has been created, and is about to be displayed.  At this time, this
  630.     **    function is called.  It generically calls the window content initialization
  631.     **    procedure indicated within the frHndl.  The default window content initialization
  632.     **    procedure is called InitContent. */
  633.  
  634.  
  635.  
  636. Boolean            DoKeyDown(EventRecord *event);
  637.     /*
  638.     **    ¶ Process key event.  Framework may call application to finish event.
  639.     **
  640.     **    INPUT:    event
  641.     **
  642.     **    DoKeyDown is first called by the application.  If the key is a menu key, the
  643.     **    AppWannabe function DoMenuCommand is called.  If the key isn’t a menu
  644.     **    key, DoKeyDown starts walking through the window list, giving each window an
  645.     **    opportunity to handle the key.  Windows can handle it, eat it, or pass the key
  646.     **    through to the next window.
  647.     **    It gives each window a chance to handle the key by calling the key handling
  648.     **    procedure stored in the frHndl.  The default procedure is called KeyDown.  Here
  649.     **    are the rules for the window key handling procedure:
  650.     **
  651.     **    1)    If it handles the key, it returns true.  This completes the key handling.
  652.     **    2)    If it doesn’t handle the key, it returns false.  However, there are two
  653.     **        situations for not handling the key:
  654.     **            a) The window wants windows behind it to try handling the key.
  655.     **            b) The window wants nobody else to look at the key.
  656.     **       This is what the boolean passThrough is for.  If the procedure wishes the next
  657.     **       window to have a look at the key, it should set the boolean passThrough to true.
  658.     **       passThrough is already initialized to false prior to calling the procedure,
  659.     **       which is the common case, so the window key handling procedure only has to
  660.     **       worry about setting it true.
  661.     **
  662.     **    If the window never processes keys and always passes them through to the next
  663.     **    window, the contentKeyProc field in the frHndl should be set to nil.  This will
  664.     **    indicate to DoKeyDown that all keys should be passed through this window.
  665.     **    DTS.Draw has such a window.  The palette window doesn’t accept keys.  They are
  666.     **    passed through to document windows that are behind the palette. */
  667.  
  668.  
  669.  
  670. void            DoMouseDown(EventRecord *event);
  671.     /*
  672.     **    ¶ Process mouseDown event.  Framework may call application to finish event.
  673.     **
  674.     **    INPUT:    event
  675.     **
  676.     **    Call this whenever a mouse down event occurs in the application.  Everything is
  677.     **    handled.  Here’s what DoMouseDown may do, and what it depends on:
  678.     **    It handles:
  679.     **        inContent
  680.     **        inDrag
  681.     **        inGoAway
  682.     **        inGrow
  683.     **        inMenuBar
  684.     **        inSysWindow
  685.     **        inZoomIn
  686.     **        inZoomOut
  687.     **
  688.     **    inContent:
  689.     **        a)    If the window clicked on is a DA window, then bring the window to the front.
  690.     **        b)    If the window is the top-most and it is a document window, then
  691.     **            DoContentClick is called.
  692.     **        c)    If the window is not the top-most of its kind (palette,dialog,document),
  693.     **            then it is made the top-most of its kind.  If the window has the
  694.     **            kwDoFirstClick bit set, then DoContentClick is called, indicating to it
  695.     **            that this click is a first click (window-to-front click).
  696.     **
  697.     **    inDrag:
  698.     **        The window is dragged.  When released, if the command key was not held down at
  699.     **        the time of the click, the window is made the top-most window of its kind.
  700.     **
  701.     **    inGoAway:
  702.     **        The go-away is tracked.  If the document is dirty, then the user is asked if
  703.     **        the document should first be saved.  The user can save, discard, or cancel.
  704.     **        All cases are handled.
  705.     **
  706.     **    inGrow:
  707.     **        The window is grown.  Scrollbar adjustments are handled as they are in the
  708.     **        7.0 finder.
  709.     **
  710.     **    inMenuBar:
  711.     **        MenuSelect is called, then the AppWannabe function DoMenuCommand is called
  712.     **        with the result of MenuSelect.
  713.     **
  714.     **    inSysWindow:
  715.     **        SystemClick is called.
  716.     **
  717.     **    inZoomIn:
  718.     **    inZoomOut:
  719.     **        The window is grown, according to the human-interface guidelines for zooming.
  720.     **        The window is zoomed on the monitor that contains most of the window.  The zoom
  721.     **        size is limited by the document size.  All of these details are handled. */
  722.  
  723.  
  724.  
  725. short            MapMItem(short menuID, short menuItem);
  726.     /*
  727.     **    ¶ Convert hard menuItem ID to a soft ID.
  728.     **
  729.     **    INPUT:    menuID        The menu ID
  730.     **            menuItem    The menuItem, as returned by the Menu Manager (hard value)
  731.     **    RESULT:    short        The soft menu value.
  732.     **
  733.     **    This function converts a menu item hard-id (one returned by the toolbox) to a
  734.     **    soft-id (defined in the 'STR#' resource associated with the menu).  If there is
  735.     **    a 'STR#' resource defined with the same id as the menu, it is assumed to be
  736.     **    for the purpose of converting hard-id values to soft-id values.
  737.     **
  738.     **    __________
  739.     **
  740.     **    Also see:    UnmapMItem. */
  741.  
  742.  
  743.  
  744. short            UnmapMItem(short menuID, short menuItem);
  745.     /*
  746.     **    ¶ Convert soft menuITem ID to a hard ID.
  747.     **
  748.     **    INPUT:    menuID
  749.     **            menuItem
  750.     **    RESULT:    short
  751.     **
  752.     **    This function is the logical reverse of MapMItem. */
  753.  
  754.  
  755.  
  756. OSErr            DoReadDocument(FileRecHndl frHndl);
  757.     /*
  758.     **    ¶ Calls document’s read-document procedure, which reads the document.
  759.     **
  760.     **    INPUT:    frHndl
  761.     **    RESULT:    OSErr
  762.     **
  763.     **    DoReadDocument calls the specific read document procedure for the document.
  764.     **    The specific procedure is stored in the frHndl field readDocumentProc.  The
  765.     **    default value for readDocumentProc is ReadDocument.  It is the responsibility
  766.     **    of the readDocument procedure to call the readDocumentHeader procedure.  This is
  767.     **    done by calling DoReadDocumentHeader from within the readDocumentProc. */
  768.  
  769.  
  770.  
  771. OSErr            DoReadDocumentHeader(FileRecHndl frHndl);
  772.     /*
  773.     **    ¶ Calls document’s document read-header procedure, which reads the header.
  774.     **
  775.     **    INPUT:    frHndl
  776.     **    RESULT:    OSErr
  777.     **
  778.     **    DoReadDocumentHeader calls the specific read document header procedure for the
  779.     **    document.  The specific procedure is stored in the frHndl field
  780.     **    readDocumentHeaderProc.  The default value for readDocumentHeaderProc
  781.     **    is DefaultReadDocumentHeader. */
  782.  
  783.  
  784.  
  785. OSErr            DefaultReadDocumentHeader(FileRecHndl frHndl);
  786.     /*
  787.     **    ¶ Read the default document header format.
  788.     **
  789.     **    INPUT:    frHndl
  790.     **    RESULT:    OSErr
  791.     **
  792.     **    This function reads in the default header for a file.  The header information is
  793.     **    described by the structure DocHeaderInfo.  The typedef for this structure is in the
  794.     **    file DTS.Lib.h.  This block of header information is saved at the beginning of the
  795.     **    file.  It is written to the data fork.  If you want the header information saved in
  796.     **    the resource fork, you will have to have a custom readDocumentHeaderProc and
  797.     **    writeDocumentHeaderProc.  You can then simply read and write using the resource
  798.     **    fork, instead of the data fork, as the defaults do. */
  799.  
  800.  
  801.  
  802. OSErr            DoWriteDocument(FileRecHndl frHndl);
  803.     /*
  804.     **    ¶ Calls document’ write document procedure.
  805.     **
  806.     **    INPUT:    frHndl
  807.     **    RESULT:    OSErr
  808.     **
  809.     **    DoWriteDocument calls the specific write document procedure for the document.
  810.     **    The specific procedure is stored in the frHndl field writeDocumentProc.  The
  811.     **    default value for writeDocumentProc is WriteDocument.  It is the responsibility
  812.     **    of the writeDocument procedure to call the writeDocumentHeader procedure.  This is
  813.     **    done by calling DoWriteDocumentHeader from within the writeDocumentProc. */
  814.  
  815.  
  816.  
  817. OSErr            DoWriteDocumentHeader(FileRecHndl frHndl);
  818.     /*
  819.     **    ¶ Calls document’s write-header procedure.
  820.     **
  821.     **    INPUT:    frHndl
  822.     **    RESULT:    OSErr
  823.     **
  824.     **    DoWriteDocumentHeader calls the specific write document header procedure
  825.     **    for the document.  The specific procedure is stored in the frHndl field
  826.     **    writeDocumentHeaderProc.  The default value for writeDocumentHeaderProc
  827.     **    is DefaultWriteDocumentHeader. */
  828.  
  829.  
  830.  
  831. OSErr            DefaultWriteDocumentHeader(FileRecHndl frHndl);
  832.     /*
  833.     **    ¶ Writes the default header format.
  834.     **
  835.     **    INPUT:    frHndl
  836.     **    RESULT:    OSErr
  837.     **
  838.     **    This function writes out the default header for a file.  The header information is
  839.     **    described by the structure DocHeaderInfo.  The typedef for this structure is in the
  840.     **    file DTS.Lib.h.  This block of header information is saved at the beginning of the
  841.     **    file.  It is written to the data fork.  If you want the header information saved in
  842.     **    the resource fork, you will have to have a custom readDocumentHeaderProc and
  843.     **    writeDocumentHeaderProc.  You can then simply read and write using the resource
  844.     **    fork, instead of the data fork, as the defaults do. */
  845.  
  846.  
  847.  
  848. void            DoResizeContent(WindowPtr window, short oldh, short oldv);
  849.     /*
  850.     **    ¶ Called after a window is resized.  This is make related changes to the content.
  851.     **
  852.     **    INPUT:    window
  853.     **            oldh
  854.     **            oldv
  855.     **
  856.     **    This function is called when a window has been resized.  It is possible that window
  857.     **    contents have to be adjusted to match the new window size.  DoResizeContent
  858.     **    handles this.  DoResizeContent uses a procedure stored in the frHndl field
  859.     **    resizeContentProc.  If resizeContentProc is not nil, then the procedure is called.
  860.     **    The default value for resizeContentProc is ResizeContent. */
  861.  
  862.  
  863.  
  864. void            DoScrollFrame(WindowPtr window, long dx, long dy);
  865.     /*
  866.     **    ¶ Scroll a document’s frame area.
  867.     **
  868.     **    INPUT:    window
  869.     **            dx
  870.     **            dy
  871.     **
  872.     **    Some applications may need to scroll the "frame" of the document along with the
  873.     **    document contents.  This is common for applications with rulers, or other similar
  874.     **    sidebar items.  DoScrollFrame is called when document scrolling has occured.
  875.     **    DoScrollFrame uses a procedure stored in the frHndl field scrollFrameProc.
  876.     **    If scrollFrameProc is not nil, then the procedure is called.  The default value
  877.     **    for scrollFrameProc is ScrollFrame. */
  878.  
  879.  
  880.  
  881. void            DoUndoFixup(FileRecHndl frHndl, Point contOrg, Boolean afterUndo);
  882.     /*
  883.     **    ¶ Part of the undo mechanism.  This dispatches to the document’s undo fixup.
  884.     **
  885.     **    INPUT:    frHndl
  886.     **            contOrg
  887.     **            afterUndo
  888.     **
  889.     **    This function is called by the hierarchical document package in response to an
  890.     **    undo/redo operation.  It is called prior to any undo information being applied
  891.     **    to the document so that you can prepare the document for an undo.  It is also
  892.     **    called after all undo tasks are performed on the document.  This last call is a
  893.     **    chance for any additional cleanup that might have to occur.  Commonly this second
  894.     **    call is used to reimage the document to show the document undone/redone.
  895.     **    DoUndoFixup doesn’t actually do the work, as it doesn’t know what kind of
  896.     **    document it was called for.  It simply looks in the frHndl at the field
  897.     **    undoFixupProc.  If undoFixupProc is not nil, then the procedure is called.
  898.     **    The default value for undoFixupProc is UndoFixup. */
  899.  
  900.  
  901.  
  902. void            CleanSendBehind(WindowPtr window, WindowPtr afterWindow);
  903.     /*
  904.     **    ¶ A better SendBehind, which is needed for floating palettes, etc.
  905.     **
  906.     **    INPUT:    window
  907.     **            afterUndo
  908.     **
  909.     **    This function is exactly what it would seem by the name.  SendBehind has some
  910.     **    problems in that it causes too much repainting of windows.  This function allows
  911.     **    you to change the layer of a window very cleanly.  It also calls HiliteWindows,
  912.     **    which walks the window list and adjusts window hilighting for the various types
  913.     **    of windows.  The top-most of a type is hilited, and all other windows of that
  914.     **    type are unhilited. */
  915.  
  916.  
  917.  
  918. void            CleanSendInFront(WindowPtr window, WindowPtr beforeWindow);
  919.     /*
  920.     **    ¶ Bring a window in front of another, while handling floating palettes, etc.
  921.     **
  922.     **    INPUT:    window
  923.     **            beforeWindow
  924.     **
  925.     **    Again, this is exactly what it would seem.  See CleanSendBehind for
  926.     **    more information. */
  927.  
  928.  
  929.  
  930. void            HiliteWindows(void);
  931.     /*
  932.     **    ¶ Makes sure that the hiliting of windows is correct.
  933.     **
  934.     **    This function is called to adjust the hilites of all windows.  Since DTS.framework
  935.     **    supports palettes, there is possibly more than one hilited window.  The window
  936.     **    manager doesn’t want to play this game, so certain additional functions had to be
  937.     **    written.  Basically, if you are using palettes, don’t make any window manager calls
  938.     **    that change window hiliting.  Use CleanSendBehind and CleanSendInFront.  These
  939.     **    take care of window shuffling correctly.  Of course, there are calls you can’t
  940.     **    avoid, such as closing a window.  If you do these operations directly, call
  941.     **    HiliteWindows afterwards. */
  942.  
  943.  
  944.  
  945. void            UnhiliteWindows(void);
  946.     /*
  947.     **    ¶ Unhilite all windows.  This is done before bringing up a modal dialog, for example.
  948.     **
  949.     **    This is called to unhilite all windows.  DTS.framework allows for multiple hilited
  950.     **    windows.  All of them have to be unhilited prior to bringing up a modal dialog or
  951.     **    alert.  Call this to unhilite all windows, do the modal dialog or alert, and then
  952.     **    call HiliteWindows to set the hiliting back to normal. */
  953.  
  954.  
  955.  
  956. void            DoUpdate(WindowPtr window);
  957.     /*
  958.     **    ¶ Update the window.  Do this in response to an update event.
  959.     **
  960.     **    INPUT:    window
  961.     **
  962.     **    This is called when an update event is received for a window.  First, the
  963.     **    updateRgn is separated into two parts.  Part 1 holds the window frame area,
  964.     **    if any.  This is the area that might hold the scrollbars, grow icon, and
  965.     **    any other application-specific frame parts.  This is drawn first.  Once
  966.     **    this is done, the remainder of the updateRgn is drawn.  This allows us to
  967.     **    handle all of the frame clipping without using the clipRgn.  By freeing up
  968.     **    the clipRgn, we allow the application to use it without having to share. */
  969.  
  970.  
  971.  
  972. void            DoSetCursor(Cursor *cursor);
  973.     /*
  974.     **    ¶ Main application cursor-setting procedure.
  975.     **
  976.     **    INPUT:    cursor
  977.     **
  978.     **    Call this function to correctly set the cursor and to inform DTS.framework that
  979.     **    you have specifically set the cursor.  This is used when you temporarily want to
  980.     **    set the cursor, such as just before a slow operation.  For a slow operation, you
  981.     **    may want to put up the wait cursor.  Use DoSetCursor for this, and then when the
  982.     **    operation is over and program control returns to the main event loop, the cursor
  983.     **    will be recalculated to the current cursor for the mouse position. */
  984.  
  985.  
  986.  
  987. CursPtr            DoSetResCursor(short crsrID);
  988.     /*
  989.     **    ¶ Given an ID, instead of a pointer, set the cursor.
  990.     **
  991.     **    INPUT:    crsrID
  992.     **    RESULT:    CursPtr
  993.     **
  994.     **    This function serves the same purpose as DoSetCursor, except that you pass in
  995.     **    a resID, instead of a cursor pointer.  The resource is loaded, the cursor is then
  996.     **    copied into permanent memory, and then DoSetCursor is called with a pointer to
  997.     **    the cursor image. */
  998.  
  999.  
  1000.  
  1001. void            DoWindowCursor(void);
  1002.     /*
  1003.     **    ¶ Iterates through the windows, giving the document a chance to set the cursor.
  1004.     **
  1005.     **    Call this function to calculate what the cursor should be for various windows.
  1006.     **    The result of this function is to set the cursor based on the current mouse
  1007.     **    position.  In addition to setting the cursor, the cursor region is calculated.
  1008.     **    The cursor region is kept in the global variable gCursorRgn.
  1009.     **    This function walks the window list, and for each document window, it calls the
  1010.     **    window’s cursor handling procedure.  The cursor handling procedure is stored in
  1011.     **    the frHndl field windowCursorProc.
  1012.     **    Here are the rules for cursor and gCursorRgn determination:
  1013.     **
  1014.     **    1)    See if the mouse position is currently inside the gCursorRgn.  If so, leave.
  1015.     **    2)    Since the mouse position is outside the current gCursorRgn, we need to
  1016.     **        recalculate the cursor.  Set the gCursorRgn to wide-open.  From now on, we
  1017.     **        will eliminate areas from gCursorRgn that don’t apply to the new mouse
  1018.     **        location and new cursor.
  1019.     **    3)    For each visible window (starting with the front window):
  1020.     **        a)    If the windowCursorProc is nil and the mouse position is over the structure
  1021.     **            region of the window, set the cursor to an arrow and intersect the gCursorRgn
  1022.     **            with the structure region of the window.  This limits the cursor to the area
  1023.     **            of the window that is visible.
  1024.     **        b)    If the windowCursorProc is nil and the mouse position is outside the
  1025.     **            structure region of the window, diff out the structure region from
  1026.     **            gCursorRgn and proceed to the next visible window in the window list.
  1027.     **        c)    If the windowCursorProc is not nil, call the procedure.  Note that the
  1028.     **            procedure is called whether or not the mouse location is over the window.
  1029.     **            This is to allow the procedure to determine if it should be the last
  1030.     **            window checked.
  1031.     **            The proc’s job is as follows:
  1032.     **            1)    If the cursor is over a position that is determined by the window, then
  1033.     **                the proc removes other areas from gCursorRgn.  Note that it should not
  1034.     **                simply set the area to what it "thinks" is the correct area.  This window
  1035.     **                may not be the front-most.  Other windows will have already been
  1036.     **                subtracted from gCursorRgn.  The resultant gCursorRgn is the correct
  1037.     **                cursor area, and should be passed to WaitNextEvent calls in the
  1038.     **                application.  Also, the cursor should be set to the correct cursor, of
  1039.     **                course.  You should also return true, as the cursor has been determined.
  1040.     **                The rule of thumb for what you should do to the gCursorRgn is that you
  1041.     **                should calculate the cursor region as if the window was the top window.
  1042.     **                Once this is done, intersect the gCursorRgn with this region.  The result
  1043.     **                should be stored in gCursorRgn.
  1044.     **                Since you determined a cursor and gCursorRgn in this case, you should
  1045.     **                return true.  Returning true indicates to DoWindowCursor that the
  1046.     **                cursor has been determined, and that it should stop processing windows.
  1047.     **            2)    If the cursor is not over a position for this window, then you should
  1048.     **                return.  You will either pass back true or false.  If you don’t wish
  1049.     **                windows behind this window to have a shot at cursor determination, then
  1050.     **                return true.  This states that the cursor is "determined".  It is, in the
  1051.     **                sense that no further determination will occur.  If you return false, then
  1052.     **                other windows get a shot at determining the cursor.  If there are no other
  1053.     **                windows, then the cursor is set to an arrow, and gCursorRgn is set to the
  1054.     **                area that is outside all windows for the application.
  1055.     **                (Common case:)  If you don’t want windows behind this one to determine
  1056.     **                the cursor:
  1057.     **                a)    Set the cursor to an arrow.  Since you are outside this window, the
  1058.     **                    cursor should be an arrow.  The cursor may be over the desktop or
  1059.     **                    menubar, or some other window that isn’t the top-most window.  All of
  1060.     **                    these cases should have an arrow cursor.  Also, you need to diff out
  1061.     **                    the window’s structure region from gCursorRgn.  By diffing it out,
  1062.     **                    you will get mouse-moved events when the cursor is moved back over
  1063.     **                    this window.
  1064.     **                b)    Return true.  This tells DoWindowCursor that the cursor has
  1065.     **                    been determined.
  1066.     **                (Uncommon case:)  If you want windows behind this one to possibly
  1067.     **                    determine the cursor:  Return false.  That’s it.  DTS.framework will
  1068.     **                    automatically remove the structure region for this window from
  1069.     **                    gCursorRgn if you return false.  If you return false, DTS.framework
  1070.     **                    proceeds to the next window, if there is one.  If there are no more
  1071.     **                    windows behind this one, then DTS.framework sets the cursor to an
  1072.     **                    arrow, and the resultant gCursorRgn will have all of the structure
  1073.     **                    regions for the windows removed from it. */
  1074.  
  1075.  
  1076.  
  1077. WindowPtr        FrontWindowOfType(long wkind, Boolean firstVis);
  1078.     /*
  1079.     **    ¶ Get front-most window meeting criteria.
  1080.     **
  1081.     **    INPUT:    wkind
  1082.     **            firstVis
  1083.     **    RESULT:    WindowPtr
  1084.     **
  1085.     **    Since DTS.framework supports three distinct categories of windows
  1086.     **    (document/palette/dialog), it is often necessary to get the front-most
  1087.     **    window of a certain type.  Use this function to accomplish this.  Basically,
  1088.     **    this takes the place of FrontWindow if you have more than one category of
  1089.     **    window in your application. */
  1090.  
  1091.  
  1092.  
  1093. short            HCenteredAlert(short alertID, WindowPtr relatedWindow, ModalFilterUPP filter);
  1094.     /*
  1095.     **    ¶ Put up an alert, and also make sure that hiliting of other windows is correct.
  1096.     **
  1097.     **    INPUT:    alertID
  1098.     **            relatedWindow
  1099.     **            filter
  1100.     **    RESULT:    short
  1101.     **
  1102.     **    This function gets an alert, and handles hiliting of windows correctly.
  1103.     **    The reason for this function is that there may be more than one hilited
  1104.     **    window due to the possibility of floating palettes.  The calls to UnhiliteWindows
  1105.     **    and HiliteWindows make sure that while the alert is up, there are no other
  1106.     **    hilited windows. */
  1107.  
  1108.  
  1109.  
  1110. OSErr            GetWindowFormats(void);
  1111.     /*
  1112.     **    ¶ Read in and unflatten resource 'WFMT' #128.
  1113.     **
  1114.     **    RESULT:    OSErr
  1115.     **
  1116.     **    This function gets the application window formats that were created with
  1117.     **    the AppsToGo application editor.  The window formats are stored in the resource
  1118.     **    'WFMT' id #128.  They are first read in, and then they are unflattened
  1119.     **    by calling HReadWindowFormats. */
  1120.  
  1121.  
  1122.  
  1123. OSErr            HReadWindowFormats(Handle wfmt);
  1124.     /*
  1125.     **    ¶ Unflattens a window-format handle into separate hierarchical document objects.
  1126.     **
  1127.     **    INPUT:    wfmt
  1128.     **    RESULT:    OSErr
  1129.     **
  1130.     **    This function is called to unflatten a window-format handle into separate
  1131.     **    hierarchical document objects.  The assumption is that there is only one
  1132.     **    of these multiple window definitions, and therefore if there is already
  1133.     **    one in the global gWindowFormats, it is disposed of.  This is exactly the
  1134.     **    behavior needed by the AppsToGo application editor. */
  1135.  
  1136.  
  1137.  
  1138. OSErr            GetSeparateWFMT(OSType sftype, short *numAdded);
  1139.     /*
  1140.     **    ¶ Add (or remove) window-format resource definition to global gWindowFormats.
  1141.     **
  1142.     **    INPUT:    sftype
  1143.     **    OUTPUT:    numAdded
  1144.     **    RESULT:    OSErr
  1145.     **
  1146.     **    This function is called to add (or remove) a window-format resource definition
  1147.     **    to the global gWindowFormats.  The purpose of this is to be able to break up the
  1148.     **    single 'WFMT' id #128 resource, which may get quite large for some applications.
  1149.     **    NewDocumentWindow and AddControlSet automatically call GetSeparateWFMT 
  1150.     **    for you.  If the document definition is in a separate 'WFMT' resource,
  1151.     **    then that definition is added to gWindowFormats long enough to be used, and then
  1152.     **    it is removed.  The 'WFMT' resource can be of any id other than 128, and must be
  1153.     **    named with the DocType, such as ABOT for the about box.  (The name must always be
  1154.     **    4 characters.)  Passing in 0 for the DocType (OSType) disposes of however many
  1155.     **    were added.  The number added is returned from the first time it is called. */
  1156.  
  1157.  
  1158.  
  1159. OSErr            AddControlSet(WindowPtr window, OSType sftype, short visMode,
  1160.                               short xoffset, short yoffset, CObjCtlHndl cco);
  1161.     /*
  1162.     **    ¶ Add a set of controls (and sets referenced by that set) to the window.
  1163.     **
  1164.     **    INPUT:    window
  1165.     **            sftype
  1166.     **            visMode
  1167.     **            xoffset
  1168.     **            yoffset
  1169.     **    IN/OUT    cco
  1170.     **    RESULT:    OSErr
  1171.     **
  1172.     **    This function adds a set of controls (and sets referenced by that set) to the
  1173.     **    window.  The control sets are created with the AppsToGo application editor. */
  1174.  
  1175.  
  1176.  
  1177. ControlHandle    MakeControl(WindowPtr window, TreeObjHndl cobj,
  1178.                             short visMode, short xoffset, short yoffset);
  1179.     /*
  1180.     **    ¶ Create a control based on the control definition object.
  1181.     **
  1182.     **    INPUT:    window
  1183.     **            cobj
  1184.     **            visMode
  1185.     **            xoffset
  1186.     **            yoffset
  1187.     **    RESULT:    ControlHandle
  1188.     **
  1189.     **    This function is used to create a control based on the control definition object.
  1190.     **    The control definition objects are created with the AppsToGo application editor. */
  1191.  
  1192.  
  1193.  
  1194. CObjCtlHndl        GetControlSet(WindowPtr window, OSType sftype, ControlHandle *retDataCtl);
  1195.     /*
  1196.     **    ¶ Return Data control that has reference to all controls in control set.
  1197.     **
  1198.     **    INPUT:    window
  1199.     **            sftype
  1200.     **    OUTPUT:    retDataCtl
  1201.     **    RESULT:    CObjCtlHndl
  1202.     **
  1203.     **    This function is called to return the handle of the Data control that has
  1204.     **    a reference to all of the controls in the control set.  Once you get the
  1205.     **    Data control, you can then look at the data in the control to get the handle
  1206.     **    of the controls within the control set. */
  1207.  
  1208.  
  1209.  
  1210. void            DisplayControlSet(WindowPtr window, OSType sftype, short visMode);
  1211.     /*
  1212.     **    ¶ Show or hide a set of controls.
  1213.     **
  1214.     **    INPUT:    window
  1215.     **            sftype
  1216.     **            visMode
  1217.     **
  1218.     **    This function is used to show or hide a set of controls. */
  1219.  
  1220.  
  1221.  
  1222. void            DrawControlSet(WindowPtr window, OSType sftype);
  1223.     /*
  1224.     **    ¶ Draw a set of controls.
  1225.     **
  1226.     **    INPUT:    window
  1227.     **            sftype
  1228.     **
  1229.     **    This function is used to draw a set of controls. */
  1230.  
  1231.  
  1232.  
  1233. void            DisposeControlSet(WindowPtr window, OSType sftype);
  1234.     /*
  1235.     **    ¶ Dispose a set of controls.
  1236.     **
  1237.     **    INPUT:    window
  1238.     **            sftype
  1239.     **
  1240.     **    This function is used to dispose a set of controls. */
  1241.  
  1242.  
  1243.  
  1244. void            DisposeControlFromSet(ControlHandle ctl, OSType sftype);
  1245.     /*
  1246.     **    ¶ Dispose a single control from a control set.
  1247.     **
  1248.     **    INPUT:    window
  1249.     **            sftype
  1250.     **
  1251.     **    This function is used to dispose a single control from a control set.  If it
  1252.     **    is the last control in the set, the dataCtl which contains the set
  1253.     **    information is also disposed of. */
  1254.  
  1255.  
  1256.  
  1257. Boolean            DoAdjustMBARMenus(WindowPtr window, short menuBarID);
  1258.     /*
  1259.     **    ¶ Adjust all of the menus in the designated MBAR.
  1260.     **
  1261.     **    INPUT:    window
  1262.     **            menuBarID
  1263.     **    RESULT:    Boolean
  1264.     **
  1265.     **    This fuction is called to adjust all of the menus in the designated MBAR. 
  1266.     **    The functions gets each menu handle, and then disables all of the menu items
  1267.     **    for that menu.  It then calls the application to give the application the
  1268.     **    chance to enable the appropriate menu items.
  1269.     **
  1270.     **    __________
  1271.     **
  1272.     **    Also see:    DoAdjustMenus
  1273.     **                    AppWannabe function where the menu handling chain
  1274.     **                    begins.  The application can do whatever it wants
  1275.     **                    to adjust the menus, but the easiest thing is to
  1276.     **                    just call DoAdjustMBARMenus.
  1277.     **
  1278.     **                AdjustMenuItems
  1279.     **                    AppWannabe function that DoAdjustMBARMenus calls
  1280.     **                    for each menu.  If the top window is not a document
  1281.     **                    window, or if there is no window, then AdjustMenuItems
  1282.     **                    is called directly.  If the top window is a document
  1283.     **                    window, then the document procPtr adjustMenuItemsProc
  1284.     **                    is called.  Note that adjustMenuItemsProc is initialized
  1285.     **                    to AdjustMenuItems.  This means that, unless you change
  1286.     **                    it, AdjustMenuItems is called in all cases. */
  1287.  
  1288.  
  1289.  
  1290. OSErr            OpenRuntimeOnlyAutoNewWindows(void);
  1291.     /*
  1292.     **    ¶ Open all windows that are correctly designated with AppsToGo application editor.
  1293.     **
  1294.     **    RESULT:    OSErr
  1295.     **
  1296.     **    This function is used to open all of the windows that are correctly designated
  1297.     **    with the AppsToGo application editor.  You should call this in your application
  1298.     **    at startup time if your application is editable with the AppsToGo
  1299.     **    application editor. */
  1300.  
  1301.  
  1302.  
  1303. OSErr            NewDocumentWindow(FileRecHndl *frHndl, OSType sftype, Boolean incTitleNum);
  1304.     /*
  1305.     **    ¶ Calls NewDocument, and if successful, DoNewWindow.
  1306.     **
  1307.     **    INPUT:    sftype
  1308.     **            incTitleNum
  1309.     **    OUTPUT:    frHndl
  1310.     **    RESULT:    OSErr
  1311.     **
  1312.     **    This call can be done as two separate calls (NewDocument / DoNewWindow).  However,
  1313.     **    this function both creates the document, and then gives the document a window.
  1314.     **    It also handles errors and puts up an error window if something goes wrong. */
  1315.  
  1316.  
  1317.  
  1318. OSErr            OpenDocumentWindow(FileRecHndl *frHndl, FSSpecPtr fileToOpen, char permission);
  1319.     /*
  1320.     **    ¶ Calls OpenDocument, and if successful, DoNewWindow.
  1321.     **
  1322.     **    INPUT:    fileToOpen
  1323.     **            permission
  1324.     **    OUTPUT:    frHndl
  1325.     **    RESULT:    OSErr
  1326.     **
  1327.     **    This call can be done as two separate calls (OpenDocument / DoNewWindow).  However,
  1328.     **    this function both creates the document, and then gives the document a window.
  1329.     **    It also handles errors and puts up an error window if something goes wrong. */
  1330.  
  1331.  
  1332.  
  1333. #ifdef __cplusplus
  1334. }
  1335. #endif
  1336.  
  1337.  
  1338.  
  1339. #endif
  1340.